package org.springblade.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author: Sharry
 * @createTime: 2023-12-30 9:57
 * @version: Version-1.0
 */
@AllArgsConstructor
@Getter
public enum FeiShuDocumentEnum {

	/**
	 * 凤仪的维保员文档
	 */
	MAINTENANCE_PERSONNEL("592800", "prod","X90IbHpfvasAkssyhgDcUfswnod",
		"tblH4f40vR5zyBZe",
		"凤仪维保员文档"),

	/**
	 * 凤仪的特检院银河电梯池子
	 */
	GOVERNMENT_ELEVATOR_POOL("592800", "prod","X90IbHpfvasAkssyhgDcUfswnod",
		"tblRRSDL1DOhsaap",
		"凤仪特检院电梯池子"),

	/**
	 * 凤仪的银河电梯排期跟踪
	 */
	GALAXY_ELEVATOR_TRACK("592800", "prod","NqmBbGjl7a8MhOstetjc4aqInXf",
		"tblRiUnEynglJSYx",
		"凤仪的银河电梯排期跟踪"),

	/**
	 * 凤仪的自动扶梯检测报告
	 */
	GALAXY_AUTO_ELEVATOR_REPORT("592800", "prod","SA09bkdS8a35yDsVpXVcZthTnrd",
		"tblDFPyIw30zsxca",
		"凤仪的自动扶梯检测报告"),

	/**
	 * 凤仪的曳引梯检测报告
	 */
	GALAXY_TRACTION_ELEVATOR_REPORT("592800", "prod","SA09bkdS8a35yDsVpXVcZthTnrd",
		"tbl2lv9pDyMrr2PP",
		"凤仪的曳引梯检测报告"),

	/**
	 * 凤仪的银河唯一识别码
	 */
	GALAXY_ELEVATOR_NUMS("592800", "prod","K9DzbBsjwawloEs5qITcK7Z1nGd",
		"tblT3kjwVufLlpYu",
		"凤仪的银河唯一识别码"),

	/**
	 * 少维的配件申请记录_正本
	 */
	PART_APPLY_RECORD("592800", "prod","R2mrbysswal4ALswDW2ck4yVnag",
		"tblUB08ZtfFwicK8",
		"少维的配件申请记录_正本"),

	/**
	 * 凤仪的在保电梯_正本
	 */
	BUILDING_ELEVATOR_UPDATE("592800", "prod","Nbh3bdduTafvhcs9Fm4cm4OFn0c",
		"tblYFcmd6EwEV5t8",
		"凤仪的项目电梯_正本"),

	/**
	 * 少维的银河维保客户_正本
	 */
	MAINTENANCE_CUSTOMER_INFORMATION("592800", "prod","XOWfbI3hBaiDwmsCRMsc8eBgnFb",
		"tblpaXni2oB7VF00",
		"少维的银河维保客户_正本"),

	/**
	 * 凤仪的电梯年审日期_正本
	 */
	ELEVATOR_ANNUAL_REVIEW_DATE("592800", "prod","X90IbHpfvasAkssyhgDcUfswnod",
		"tblvhys4frh8jItz",
		"凤仪的电梯年审日期_正本"),

	/**
	 * 凤仪的维保员文档_副本，调式专用
	 */
	MAINTENANCE_PERSONNEL_COPY("592800", "test","GYKcbRElTaTduUs3tqkcxRHsnMf",
		"tblNQouLBWEfSyyw",
		"凤仪维保员文档_副本"),

	/**
	 * 凤仪的特检院银河电梯池子_副本，调式专用
	 */
	GOVERNMENT_ELEVATOR_POOL_COPY("592800", "test","GYKcbRElTaTduUs3tqkcxRHsnMf",
		"tbl1mub3zBMTR6Aq",
		"凤仪特检院电梯池子_副本"),

	/**
	 * 凤仪的银河电梯排期跟踪_副本，调式专用
	 */
	GALAXY_ELEVATOR_TRACK_COPY("592800", "test","JyWgbc0zRazjpnsl2FXcl58Hnvc",
		"tblIcQvVJiaR7EJY",
		"凤仪的银河电梯排期跟踪_副本"),

	/**
	 * 凤仪的银河特检院电梯维保有效期_副本，调式专用
	 */
	GOVERNMENT_ELEVATOR_TRACK_COPY("592800", "test","GYKcbRElTaTduUs3tqkcxRHsnMf",
		"tblez7JNq0KjwsfP",
		"凤仪的银河特检院电梯维保有效期_副本"),

	/**
	 * 少维的配件申请记录_副本，调式专用
	 */
	PART_APPLY_RECORD_COPY("592800", "test","R2mrbysswal4ALswDW2ck4yVnag",
		"tblAnERudfoSdAZ5",
		"少维的配件申请记录_副本"),

	/**
	 * 少维的配件申请记录_副本，调式专用
	 */
	PART_APPLY_RECORD_COPY2("592800", "test","R2mrbysswal4ALswDW2ck4yVnag",
		"tblQAJUr2QuWCrGs",
		"配件流程协作 副本 2"),

	/**
	 * 少维的银河维保客户_副本，调式专用
	 */
	MAINTENANCE_CUSTOMER_INFORMATION_COPY("592800", "test","XOWfbI3hBaiDwmsCRMsc8eBgnFb",
		"tblex1w1uRE7hup6",
		"少维的银河维保客户_副本"),

	/**
	 * 凤仪的电梯年审日期_副本，调式专用
	 */
	ELEVATOR_ANNUAL_REVIEW_DATE_COPY("592800", "test","GYKcbRElTaTduUs3tqkcxRHsnMf",
		"tbl1S3jWyHVVCkYS",
		"凤仪的电梯年审日期_副本");

	/**
	 * 租户id
	 */
	final String tenantId;

	/**
	 * 环境变量
	 */
	final String env;

	final String appToken;

	final String tableId;

	final String description;

	/**
	 * 根据 appToken 与 tableId 获取文档描述
	 * @return 文档描述
	 */
	public static String getDescription(String appToken, String tableId) {
		for (FeiShuDocumentEnum value : FeiShuDocumentEnum.values()) {
			if (value.getAppToken().equals(appToken) && value.getTableId().equals(tableId)) {
				return value.getDescription();
			}
		}
		return null;
	}

	/**
	 * 获取枚举
	 * @param env 环境变量
	 * @param appToken token
	 * @param tableId 文档id
	 * @return
	 */
	public static FeiShuDocumentEnum getEnum(String env, String appToken, String tableId) {
		if (env.equals("dev")) {
			env = "test";
		}
		for (FeiShuDocumentEnum value : FeiShuDocumentEnum.values()) {
            if (value.getEnv().equals(env) && value.getAppToken().equals(appToken) && value.getTableId().equals(tableId)) {
                return value;
            }
        }
        return null;
    }

}
